<html>
<body>
<p>Test IsProviderInstalled.<p>
<div id=result>
</div>
<script>
var passedAll = true;

function log(message) {
  document.getElementById("result").innerHTML += message + "<br>";
}

function logPassed(message) {
  log("PASS: " + message);
}

function logFailed(message) {
  passedAll = false;
  log("FAIL: " + message);
}

function writeResult() {
  if (passedAll) {
    logPassed("Everything passed.");
    document.title = "OK";
  } else {
    logFailed("At least one test failed.");
    document.title = "FAIL";
  }
}

function MyObject() {
}

try {
  MyObject.prototype.toString = function() { throw "test"; }
  var object = new MyObject();

  // Verify the search provider state for the current page.
  var installed = window.external.IsSearchProviderInstalled(object)
  writeResult();
} catch (e) {
  logFailed("An exception occurred. Name: " + e.name + " Message: " +
            e.message);
  writeResult();
}
</script>
</body>
</html>
